%%
%% This is file `cn-fonts.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% scunthesis.dtx  (with options: `cn-fonts')
%%
%% This is a generated file.
%%
%% Copyright (C) 2016-2016 by Yang Ximin <refmanager@163.com>
%%
%% This file may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3a
%% of this license or (at your option) any later version.
%% The latest version of this license is in:
%%
%% http://www.latex-project.org/lppl.txt
%%
%% and version 1.3a or later is part of all distributions of LaTeX version 2004/10/01 or later.
%%
%% To produce the documentation run the original source files ending with `.dtx' through LaTeX.
%%
\ProvidesPackage{cn-fonts}
\RequirePackage{xunicode,xltxtra}
%%[cm-default]选项主要用来解决使用数学环境时数学符号不能正常显示的问题。
\RequirePackage{fontspec}
\RequirePackage{xeCJK}
\defaultfontfeatures{Mapping=tex-text} %如果没有它，会有一些 tex 特殊字符无法正常使用，比如连字符。
\xeCJKsetup{CJKmath=true, CheckSingle=true, PlainEquation=true}
\makeatletter

\def\fontname@adobeHei{Adobe Heiti Std}
\def\fontname@adobeSong{Adobe Song Std}
\def\fontname@adobeKai{Adobe Kaiti Std}
\def\fontname@adobeFangsong{Adobe Fangsong Std}
\def\fontname@msHei{SimHei}
\def\fontname@msSong{SimSun}
\def\fontname@msKai{楷体}
\def\fontname@msXingkai{STXingkai}
\def\fontname@macHei{STHeitiSC-Medium}
\def\fontname@macSong{STSongti-SC-Regular}
\def\fontname@macKai{STKaiti}
\def\fontname@macXingkai{STXingkai-SC-Light}
\def\fontname@mono{Times New Roman}%等宽字体使用Times New Roman
\def\fontname@roman{Times New Roman}%等宽字体使用Times New Roman
\let\fontname@songti\fontname@msSong
\let\fontname@heiti\fontname@msHei
\let\fontname@kaiti\fontname@msKai
\let\fontname@xingkai\fontname@msXingkai

\setCJKfamilyfont{SONG}{\fontname@songti}
\newcommand{\song}{\CJKfamily{SONG}}
\setCJKfamilyfont{KAI}{\fontname@kaiti}
\newcommand{\kai}{\CJKfamily{KAI}}
\setCJKfamilyfont{HEI}{\fontname@heiti}
\newcommand{\hei}{\CJKfamily{HEI}}
\setCJKfamilyfont{XINGKAI}{\fontname@xingkai}
\newcommand{\xingkai}{\CJKfamily{XINGKAI}}
\newcommand\setMathFont[1]{%
    \xeCJKsetup{CJKmath=true}
    \setCJKmathfont{#1}%
}
\setCJKmainfont[BoldFont=\fontname@songti, ItalicFont=\fontname@songti]{\fontname@songti}
\setCJKsansfont[BoldFont=\fontname@heiti, ItalicFont=\fontname@heiti]{\fontname@heiti}
\setCJKmonofont[BoldFont=\fontname@songti, ItalicFont=\fontname@songti]{\fontname@songti}
\setmainfont[BoldFont={Times New Roman Bold}, ItalicFont={Times New Roman Italic}]{Times New Roman}
\setsansfont[BoldFont={Arial}, ItalicFont={Arial}]{Arial}
\setmonofont[BoldFont={Courier New}, ItalicFont={Courier New}]{Courier New}

\XeTeXlinebreaklocale "zh"
\XeTeXlinebreakskip = 0pt plus 1pt minus 0.1pt

\def\define@fontsize#1#2{%
    \expandafter\newcommand\csname #1\endcsname{%
        \fontsize{#2}{\baselineskip}\selectfont}}
\define@fontsize{chuhao}{42pt} %初号
\define@fontsize{xiaochu}{36pt} %小初
\define@fontsize{yihao}{26pt} %一号
\define@fontsize{xiaoyi}{24pt} %小一号
\define@fontsize{erhao}{22pt} %二号
\define@fontsize{xiaoer}{18pt} %小二号
\define@fontsize{sanhao}{16pt} %三号
\define@fontsize{xiaosan}{15pt} %小三号
\define@fontsize{sihao}{14pt} %四号
\define@fontsize{banxiaosi}{13pt} %半小四号，这个较少用到
\define@fontsize{xiaosi}{12pt} %小四号
\define@fontsize{dawu}{11pt} %大五号，这个较少用到
\define@fontsize{wuhao}{10.5pt} %五号
\define@fontsize{xiaowu}{9pt} %小五号
\define@fontsize{liuhao}{7.5pt} %六号
\define@fontsize{xiaoliu}{6.5pt} %小六号
\define@fontsize{qihao}{5.5pt} %七号
\define@fontsize{bahao}{5pt} %八号
\renewcommand\normalsize{%
    \@setfontsize\normalsize{12pt}{20bp}%
    \abovedisplayskip=20bp \@plus 2bp \@minus 2bp
    \abovedisplayshortskip=20bp \@plus 2bp \@minus 2bp
    \belowdisplayskip=\abovedisplayskip
    \belowdisplayshortskip=\abovedisplayshortskip}

\newcommand{\cdigit}[1]{%
    \ifcase#1{０}\or{１}\or{２}\or{３}\or{４}\or{５}\or{６}\or{７}\or{８}\or{９}\fi}
\newcommand{\cnumber}[1]{%
    \ifcase#1{〇}\or{一}\or{二}\or{三}\or{四}\or{五}\or{六}\or{七}\or{八}\or{九}\or{十}\fi}
\newcommand{\cNumber}[1]{%
    \ifcase#1{零}\or{壹}\or{贰}\or{叁}\or{肆}\or{伍}\or{陆}\or{柒}\or{捌}\or{玖}\or{拾}\fi}
\newcommand{\ccunit}[1]{\ifcase#1 {个}\or{拾}\or{百}\or{千}\or{万}\or{亿}\fi}
\newcommand{\ccUnit}[1]{\ifcase#1 {个}\or{拾}\or{佰}\or{仟}\or{万}\or{亿}\fi}

\makeatother
\endinput
%%
%% End of file `cn-fonts.sty'.
